package com.xdb.sqlparser.ast.statement;

import java.util.ArrayList;
import java.util.List;

import com.xdb.sqlparser.ast.SQLName;
import com.xdb.sqlparser.ast.AbstractSQLStatementImpl;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class SQLCreateIndexStatement extends AbstractSQLStatementImpl implements SQLDDLStatement {

	private SQLName name;

	private SQLTableSource table;

	private List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();

	private String type;

	public SQLCreateIndexStatement() {

	}

	public SQLCreateIndexStatement(String dbType) {
		super(dbType);
	}

	public SQLTableSource getTable() {
		return table;
	}

	public void setTable(SQLName table) {
		this.setTable(new SQLExprTableSource(table));
	}

	public void setTable(SQLTableSource table) {
		this.table = table;
	}

	public List<SQLSelectOrderByItem> getItems() {
		return items;
	}

	public void setItems(List<SQLSelectOrderByItem> items) {
		this.items = items;
	}

	public SQLName getName() {
		return name;
	}

	public void setName(SQLName name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, getName());
			acceptChild(visitor, getTable());
			acceptChild(visitor, getItems());
		}
		visitor.endVisit(this);
	}
}
